<template>
	<view>
		<view class="one">
			<view class="u-p-20 u-flex u-p-t-40">
				<u-image :src="userinfo.avatar" mode="aspectFill" width="93rpx" height='93rpx' shape="circle">
				</u-image>
				<view class="u-h-100 u-m-l-24">
					<view class="">
						<view class="u-flex">
							<view class="u-weight cl_FFF">{{userinfo.name}}</view>
							<view class="u-flex u-m-l-20" style="padding: 4rpx 10rpx;background-color: #F36016;">
								<view class="u-h-40">
									<u-image src='https://www.sqkjkj.vip/wxImg/my/img35.png' width='23rpx' height='23rpx'></u-image>
								</view>
								<view class="u-font-26 cl_FFF">{{userinfo.identity_title || '合伙人'}}</view>
							</view>
						</view>
					</view>
					<view class="cl_FFF u-font-26 u-m-t-10">{{userinfo.mobile}}</view>
					<view class="cl_FFF u-font-26 u-m-t-10">合伙人总收益：{{userinfo.all_profit || 0}}</view>
				</view>
			</view>
		</view>
		
		<view class="bg_FFFFFF u-p-20 " style="margin-top: -50rpx;border-radius: 20rpx 20rpx 0 0;">
			<view class="u-flex u-row-between u-p-20">
				<view class="u-flex">
					<view class="u-w-6 u-h-24 u-b-r-4" style="background-color:#FF5C23;"></view>
					<view class="u-p-l-20 u-weight">合伙人数据</view>
				</view>
			</view>
			<view class="">
				<u-row>
					<u-col span='4'>
						<view @click="$u.route('/subcontract/myshoppeople/partnerInfo')" class="u-b-r-20 u-m-t-20 u-p-20 u-text-center" style="background-color: #F7F6F2;">
							<view class="u-font-20 u-h-60" style="color: #454545;">我的团队</view>
							<view class="u-weight u-m-t-10 u-font-30 ">{{userinfo.settle_commission || 0}}</view>
						</view>
					</u-col>
					<u-col span='4'>
						<view class="u-b-r-20 u-m-t-20 u-p-20 u-text-center" style="background-color: #F7F6F2;">
							<view class="u-font-20 u-h-60" style="color: #000000;">商户订单提成</view>
							<view class="u-weight u-m-t-10 u-font-30 ">￥{{userinfo.commission || 0}}</view>
						</view>
					</u-col>
					<u-col span='4'>
						<view class="u-b-r-20 u-m-t-20 u-p-20 u-text-center" style="background-color: #F7F6F2;">
							<view class="u-font-20 u-h-60" style="color: #000000;">合伙人推荐奖励</view>
							<view class="u-weight u-m-t-10 u-font-30 ">{{userinfo.partner_zt_jt_reward || 0}}</view>
						</view>
					</u-col>
					<u-col span='4'>
						<view class="u-b-r-20 u-m-t-20 u-p-20 u-text-center" style="background-color: #F7F6F2;">
							<view class="u-font-20 u-h-60" style="color: #000000;">间/直推商户数</view>
							<view class="u-weight u-m-t-10 u-font-30 ">{{userinfo.jt_shop_num || 0}}/{{userinfo.zt_shop_num || 0}}</view>
						</view>
					</u-col>
					<u-col span='4'>
						<view class="u-b-r-20 u-m-t-20 u-p-20 u-text-center" style="background-color: #F7F6F2;">
							<view class="u-font-20 u-h-60" style="color: #000000;">直推合伙人收益提成</view>
							<view class="u-weight u-m-t-10 u-font-30 ">￥{{userinfo.zc_partner_income_commission || 0}}</view>
						</view>
					</u-col>
					<u-col span='4'>
						<view class="u-b-r-20 u-m-t-20 u-p-20 u-text-center" style="background-color: #F7F6F2;">
							<view class="u-font-20 u-h-60" style="color: #000000;">间推合伙人收益提成</view>
							<view class="u-weight u-m-t-10 u-font-30 ">￥{{userinfo.jt_partner_income_commission || 0}}</view>
						</view>
					</u-col>
				</u-row>
			</view>
		</view>
		
		<view class="u-p-20 bg_FFFFFF">
			<view class="u-flex u-p-20">
				<view class="u-w-6 u-h-24 u-b-r-4" style="background-color:#FF5C23;"></view>
				<view class="u-p-l-20 u-weight">商户详情</view>
				<view v-if="userinfo.my_merchant_list" class="u-font-20 u-m-l-10">(<text style="color: #FF3846;">{{userinfo.my_merchant_list.total}}</text>商户)</view>
			</view>
			<view v-for="(item,index) in list" :key="index" class="u-p-20 " style="border-bottom: 1rpx solid #EAEAEA;margin-top: 10rpx;">
				<view class=" u-flex" @click="$u.route(`/pages/shopmassage/shopmassage?num=${item.shop_id}`)">
					<view class="u-w-94">
						<u-image :src="item.logo_url" mode="aspectFill" width="93rpx" height='93rpx'
							shape="circle">
						</u-image>
					</view>
					<view class="u-h-100 u-m-l-24">
						<view class="u-flex u-w-580 u-row-between">
							<view class="u-weight">{{item.name}}</view>
							<view class="u-font-20" style="color: #FC3533;">{{item.expire_days}}</view>
						</view>
						<view class=" u-font-20 u-flex u-row-between">
							<view class="">{{item.mobile}}</view>
							<view style="color: #898989;">{{item.register_date}}注册</view>
						</view>
					</view>
				</view>
				<view class="u-m-t-20 u-flex u-font-28 cl_848484FF">
					<view class="">
						当日销售额：{{item.today_sales_money}}
					</view>
					<view class="u-m-l-10">
						总销售额：{{item.all_sales_money}}
					</view>
					<view class="u-m-l-10">
						商品数量：{{item.goods_num}}
					</view>
				</view>
				<view class="u-b-r-20" style="background-color:#F6F6F6 ;">
					<view class="u-p-10 u-flex u-m-t-20">
						<view class="u-flex">
							<u-image src="https://www.sqkjkj.vip/wxImg/clear/img2.png" mode="aspectFill" width="28rpx" height='28rpx'>
							</u-image>
							<view @click="$com.makePhoneCall(item.mobile)" class="u-m-l-10 u-font-20"><text class="cl_848484FF">电话:</text>{{item.mobile}}</view>
						</view>

						<view @click="$com.setClipboardData(item.mobile)" class="u-flex u-m-l-20">
							<u-image src="https://www.sqkjkj.vip/wxImg/clear/wx.png" mode="aspectFill" width="28rpx" height='28rpx'>
							</u-image>
							<view class="u-m-l-10 u-font-20 u-m-r-20"><text class="cl_848484FF">微信:</text>{{item.wechat}}
							</view>
							<u-image src="https://www.sqkjkj.vip/wxImg/clear/img3.png" mode="aspectFill" width="28rpx" height='28rpx'>
							</u-image>
						</view>
					</view>
					<view class="u-flex u-m-t-16 u-p-10">
						<u-image src="https://www.sqkjkj.vip/wxImg/clear/img4.png" mode="aspectFill" width="28rpx" height='28rpx'>
						</u-image>
						<view @click="openLocation(item)" class="u-m-l-10 u-font-20 u-m-r-20"><text class="cl_848484FF">地址:</text>
							{{item.area}}{{item.address}}</view>
					</view>
				</view>
			</view>
			<u-loadmore :status="status" icon-type="circle" margin-top="20" margin-bottom="20" />
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				userinfo: '',
				list:[],
				params:{
					page:1,
					page_size:20
				},
				status: 'loadmore',
			}
		},
		onLoad() {
			this.my_merchant_list()
		},
		// 下拉到底事件
		onReachBottom() {
			//避免多次触发
			if (this.status == 'loading' || this.status == 'nomore') {
				return;
			}
			if(this.list.length>20){
				this.my_merchant_list();
			}
		},
		methods: {
			// 好物推荐
			async my_merchant_list() {
				await this.$api.my_merchant_list(this.params, res => {
					if (res.data.code == 1) {
						this.userinfo = res.data.data
						if (res.data.code == 1) {
							if (res.data.data.my_merchant_list.data.length < 20) {
								this.status = 'nomore';
							} else {
								this.params.page = this.params.page + 1;
								this.status = 'loadmore';
							}
							this.list = this.list.concat(res.data.data.my_merchant_list.data);
							uni.stopPullDownRefresh();
						}
					}
				})
			},
			openLocation(item){
				this.$com.openLocation(Number(item.latitude),Number(item.longitude))
			}
		}
	}
</script>

<style scoped>
	.one {
		width: 750rpx;
		height: 250rpx;
		background: url('https://www.sqkjkj.vip/wxImg/team/img.png') no-repeat;
		background-size: 100% 100%;
	}
</style>
